package chpt09;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

//201521123007
public class Client {
	public static void main(String[] args) {
		try {
			Socket s = new Socket("127.0.0.1", 8189);
			try {
				InputStream instream = s.getInputStream();
				Scanner in = new Scanner(instream);
				PrintWriter out = new PrintWriter(s.getOutputStream());
				Scanner sc = new Scanner(System.in);
				String l = sc.nextLine();
				out.println(l);
				out.flush();
				while (in.hasNextLine()) {
					String line = in.nextLine();
					System.out.println(line);
				}
				in.close();
				sc.close();
			} finally {
				s.close();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
